﻿
using Newtonsoft.Json;
using Shared.Method;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;

namespace Shared.Model
{
    /// <summary>
    /// 所有表的基类，主要用来区分条件和更新的属性
    /// </summary>
    public class TableBase
    {
        [JsonProperty]//让jsonconvert在执行转换的时候，转换这两个内部变量
        private List<string> ListWhere { get { return _listW; } set { _listW = value; } }//保存条件的属性名称
        private List<string> _listW = new List<string>();

        [JsonProperty]
        private List<string> ListUpdate { get { return _listU; } set { _listU = value; } }//保存更改的属性名称
        private List<string> _listU = new List<string>();

        [JsonProperty]
        private string StrWhereSQL { get; set; }//额外的条件

        private int _isWhereOrUpdate = 0;//是否条件，为0既不是更新也不是条件

        /// <summary>
        /// 设置接下来赋值的属性不写入_listWhere和_listUpdate
        /// </summary>
        public void SetNothing()
        {
            _isWhereOrUpdate = 0;
        }
        /// <summary>
        /// 设置接下来赋值的属性是条件
        /// </summary>
        public void SetWhere(string strSQL = null)
        {
            if (string.IsNullOrEmpty(strSQL))//当SQL为空时，执行条件插入操作；当SQL语句不为空时，写入额外的SQL
                _isWhereOrUpdate = 1;
            else
                StrWhereSQL = strSQL;
        }
        /// <summary>
        /// 设置接下来赋值的属性是更新值
        /// </summary>
        public void SetUpdate()
        {
            _isWhereOrUpdate = 2;
        }

        public string GetStrWhereSQL()
        {
            return StrWhereSQL;
        }
        /// <summary>
        /// 返回条件属性队列
        /// </summary>
        /// <returns></returns>
        public List<string> GetListWhere()
        {
            return ListWhere;
        }
        /// <summary>
        /// 返回更新属性队列
        /// </summary>
        /// <returns></returns>
        public List<string> GetListUpdate()
        {
            return ListUpdate;
        }

        /// <summary>
        /// 将修改的数据增加到List中，注意此方法会将原来保存在LIST中的数据删除
        /// </summary>
        /// <param name="value">属性名称</param>
        /// <param name="update">更新的列名</param>
        public void AddP(string value)
        {

            for (int i = 0; i < ListUpdate.Count; i++)//时间复杂度O(2n-index)
            {
                if (ListUpdate[i] == value)
                {
                    ListUpdate.RemoveAt(i);
                }
            }
            for (int i = 0; i < ListWhere.Count; i++)//时间复杂度O(2n-index)
            {
                if (ListWhere[i] == value)
                {
                    ListWhere.RemoveAt(i);
                }
            }

            //添加数据到List中
            if (_isWhereOrUpdate == 1)
            {
                ListWhere.Add(value);
            }
            else if (_isWhereOrUpdate == 2)  //如果是能更新的字段
            {
                ListUpdate.Add(value);
            }
        }
        /// <summary>
        /// 清空更新和条件队列
        /// </summary>
        public void Clear()
        {
            ListWhere.Clear();
            ListUpdate.Clear();
            StrWhereSQL = null;
        }

        /// <summary>
        /// 获得set方法所在的属性名称
        /// 若使用release版本，frame.GetMethod()获取的是执行的方法，不会获取类中的方法。
        /// release中会获取如TestSelect*()的方法，Debug获取SetProperity方法
        /// </summary>
        /// <returns>返回属性名称</returns>
        public string GetPN([CallerMemberName] string methodName = "")
        {
            //LogHelper.WriteDebugLogTxt("MethodName",methodName);
            return methodName;
            //StackTrace trace = new StackTrace(true);
        }
    }


    /// <summary>
    /// 主键
    /// </summary>
    public class PRIMARY_KEY : TableBase
    {
        public  long ID { get { return _id; } set { _id = value; AddP(GetPN()); } }//增加了判定条件还是更新的操作
        private long _id;
    }

    #region 测试数据库TRTEST
    /// <summary>
    /// 测试顶层表
    /// </summary>
    public class TEST_TOP : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = { };
        public string PROJECT { get { return _project; } set { _project = value; AddP(GetPN()); } }
        private string _project;
        public string RESULT { get { return _result; } set { _result = value; AddP(GetPN()); } }
        private string _result;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        public long? PROCESS_ID { get { return _process_id; } set { _process_id = value; AddP(GetPN()); } }
        private long? _process_id;
    }

    public class PACKING : PRIMARY_KEY
    {
        public string MAC { get { return _mac; } set { _mac = value; AddP(GetPN()); } }
        private string _mac;
        public string IDENTIFY { get { return _identify; } set { _identify = value; AddP(GetPN()); } }
        private string _identify;
        public string SN { get { return _sn; } set { _sn = value; AddP(GetPN()); } }
        private string _sn;
        public string BOX_NO { get { return _box_no; } set { _box_no = value; AddP(GetPN()); } }
        private string _box_no;
        public string PROVINCE { get { return _province; } set { _province = value; AddP(GetPN()); } }
        private string _province;
        public string DEVICE_TYPE { get { return _device_type; } set { _device_type = value; AddP(GetPN()); } }
        private string _device_type;
        public string PACKING_NUM { get { return _packing_num; } set { _packing_num = value; AddP(GetPN()); } }
        private string _packing_num;
        public string BATCH { get { return _batch; } set { _batch = value; AddP(GetPN()); } }
        private string _batch;
        public DateTime PACKING_TIME { get { return _packing_time; } set { _packing_time = value; AddP(GetPN()); } }
        private DateTime _packing_time;
    }

    /// <summary>
    /// 测试结果二层表
    /// </summary>
    //public class TEST_SECOND : PRIMARY_KEY
    //{
    //    //private static readonly string[] UPDATE = { };
    //    public long? TOP_ID { get { return _top_id; } set { _top_id = value; AddP(GetPN()); } }
    //    private long? _top_id;
    //    public string PROJECT { get { return _project; } set { _project = value; AddP(GetPN()); } }
    //    private string _project;
    //    public string RESULT { get { return _result; } set { _result = value; AddP(GetPN()); } }
    //    private string _result;
    //    public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
    //    private string _context;
    //    public long? PROCESS_ID { get { return _process_id; } set { _process_id = value; AddP(GetPN()); } }
    //    private long? _process_id;
    //}
    /// <summary>
    /// 测试具体数据表
    /// </summary>
    //public class TEST_SECOND : PRIMARY_KEY
    //{
    //    //private static readonly string[] UPDATE = { };
    //    public long? TOP_ID { get { return _top_id; } set { _top_id = value; AddP(GetPN()); } }
    //    private long? _top_id;
    //    public string TYPE { get { return _type; } set { _type = value; AddP(GetPN()); } }
    //    private string _type;
    //    public string PROJECT { get { return _project; } set { _project = value; AddP(GetPN()); } }
    //    private string _project;
    //    public string RESULT { get { return _result; } set { _result = value; AddP(GetPN()); } }
    //    private string _result;
    //    public string TESTDATA { get { return _testdata; } set { _testdata = value; AddP(GetPN()); } }
    //    private string _testdata;
    //    public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
    //    private string _context;
    //    public long? PROCESS_ID { get { return _process_id; } set { _process_id = value; AddP(GetPN()); } }
    //    private long? _process_id;
    //}
    #endregion
    #region 管理流程数据库TRCTL
    /// <summary>
    /// 错误信息表
    /// </summary>
    public class ERROR : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = {"CONTEXT", "METHOD"};
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        //public long? METHOD_ID { get { return _method_id; } set { _method_id = value; AddP(GetPN()); } }
        //private long? _method_id;
        //public long? FLOW_ID { get { return _flow_id; } set { _flow_id = value; AddP(GetPN()); } }
        //private long? _flow_id;
    }
    /// <summary>
    /// 错误处理方法表
    /// </summary>
    //public class METHOD : PRIMARY_KEY
    //{
    //    private static readonly string[] UPDATE = { "CONTEXT" };
    //    public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
    //    private string _context;
    //}

    /// <summary>
    /// 流水线表，一个流水线的总名称
    /// </summary>
    public class FLOW : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = { "NAME","CONTEXT", "NODE_START", "NODE_END", "NODE_ALL" };
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        public long? NODE_START { get { return _node_s; } set { _node_s = value; AddP(GetPN()); } }
        private long? _node_s;
        public long? NODE_END { get { return _node_e; } set { _node_e = value; AddP(GetPN()); } }
        private long? _node_e;
        public string NODE_ALL { get { return _node_all; } set { _node_all = value; AddP(GetPN()); } }
        private string _node_all;
        public int?  SORT { get { return _sort; } set { _sort = value; AddP(GetPN()); } }
        private int?  _sort;
        //增加一个品类ID_ADD_11.1
        public long? FLOW_GROUP_ID { get { return _group; } set { _group = value; AddP(GetPN()); } }
        private long? _group;
    }
    /// <summary>
    /// 流程集合表
    /// </summary>
    public class FLOW_GROUP:PRIMARY_KEY
    {
        //流程集合_名称
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
    }
    /// <summary>
    /// 生产线名称表
    /// </summary>
    public class LINE : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = {"NAME","FLOW_ID","CONTEXT" };
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public long? FLOW_ID { get { return _flow_id; } set { _flow_id = value; AddP(GetPN()); } }
        private long? _flow_id;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        public long? LEADER_ID { get { return _leader_id; } set { _leader_id = value; AddP(GetPN()); } }
        private long? _leader_id;
        public string LEADER_NAME { get { return _leader_name; } set { _leader_name = value; AddP(GetPN()); } }
        private string _leader_name;
    }
    /// <summary>
    /// 工序表
    /// </summary>
    public class NODE : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = { "NAME","FLOW_ID","CONTEXT", "FLOW_NAME", "SORT","LAST_ID", "NEXT_ID","ERROR_ID","FLAG" };
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        public long? FLOW_ID { get { return _flow_id; } set { _flow_id = value; AddP(GetPN()); } }
        private long? _flow_id;
        public string FLOW_NAME { get { return _flow_name; } set { _flow_name = value; AddP(GetPN()); } }
        private string _flow_name;
        public int? SORT { get { return _sort; } set { _sort = value; AddP(GetPN()); } }
        private int? _sort;
        public long? LAST_ID { get { return _last_id; } set { _last_id = value; AddP(GetPN()); } }
        private long? _last_id;
        public long? NEXT_ID { get { return _next_id; } set { _next_id = value; AddP(GetPN()); } }
        private long? _next_id;
        public long? ERROR_ID { get { return _error_id; } set { _error_id = value; AddP(GetPN()); } }
        private long? _error_id;
        public bool? FLAG { get { return _flag; } set { _flag = value; AddP(GetPN()); } }
        private bool? _flag;
    }
    /// <summary>
    /// 生产过程表
    /// </summary>
    public class PROCESS : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = { };
        //public long? PRODUCT_ID { get { return _product_id; } set { _product_id = value; AddP(GetPN()); } }
        //private long? _product_id;
        public string MAC { get { return _mac; } set { _mac = value; AddP(GetPN()); } }
        private string _mac;
        public long? WORKER_ID { get { return _worker_id; } set { _worker_id = value; AddP(GetPN()); } }
        private long? _worker_id;
        public string WORKER_NAME { get { return _worker_name; } set { _worker_name = value; AddP(GetPN()); } }
        private string _worker_name;
        public long? FLOW_ID { get { return _flow_id; } set { _flow_id = value; AddP(GetPN()); } }
        private long? _flow_id;
        public long? LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
        private long? _line_id;
        public long? NODE_ID { get { return _node_id; } set { _node_id = value; AddP(GetPN()); } }
        private long? _node_id;
        //public string NODE_NAME { get { return _node_name; } set { _node_name = value; AddP(GetPN()); } }
        //private string _node_name;
        public long? STATION_ID { get { return _station_id; } set { _station_id = value; AddP(GetPN()); } }
        private long? _station_id;
        public long? TEST_RESULT_ONE { get { return _test_result_one; } set { _test_result_one = value; AddP(GetPN()); } }
        private long? _test_result_one;
        public long? TEST_RESULT_TWO { get { return _test_result_two; } set { _test_result_two = value; AddP(GetPN()); } }
        private long? _test_result_two;
        public string TEST_RESULT { get { return _test_result; } set { _test_result = value; AddP(GetPN()); } }
        private string _test_result;
        public DateTime? START_TIME { get { return _start_time; } set { _start_time = value; AddP(GetPN()); } }
        private DateTime? _start_time;
        public DateTime? END_TIME { get { return _end_time; } set { _end_time = value; AddP(GetPN()); } }
        private DateTime? _end_time;
    }
    /// <summary>
    /// 产品状态表
    /// </summary>
    public class PRODUCT : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = {"MAC", "SN","IDENTIFY","BOX_SN","FLOW_ID","FLOW_NAME",
        //       "LINE_ID" ,"PROCESS_ALL","NODE_ID","TEST_RESULT","ERROR_ID" ,"START_TIME","END_TIME","STATE","FLOW_STATE","BREAK_STATE"};
        public string MAC { get { return _mac; } set { _mac = value; AddP(GetPN()); } }
        private string _mac;
        
        public string YCD_MAC { get { return _ycd_mac; } set { _ycd_mac = value; AddP(GetPN()); } }
        private string _ycd_mac;
        //public long? DEVICE_DATA_ID { get { return _device_data_id; } set { _device_data_id = value; AddP(GetPN()); } }
        //private long? _device_data_id;
        //public string PON_TYPE { get { return _pon_type; } set { _pon_type = value; AddP(GetPN()); } }
        //private string _pon_type;
        //public string LIGHT_MODULE_SN { get { return _light_module_sn; } set { _light_module_sn = value; AddP(GetPN()); } }
        //private string _light_module_sn;

        //public string SN { get { return _sn; } set { _sn = value; AddP(GetPN()); } }
        //private string _sn;
        //public string IDENTIFY { get { return _identify; } set { _identify = value; AddP(GetPN()); } }
        //private string _identify;
        //public string TYPE { get { return _type; } set { _type = value; AddP(GetPN()); } }
        //private string _type;
        //public string PRODUCT_CODE { get { return _code; } set { _code = value; AddP(GetPN()); } }
        //private string _code;
        //public string PROVINCE { get { return _province; } set { _province = value; AddP(GetPN()); } }
        //private string _province;
        //public string BOX_SN { get { return _box_sn; } set { _box_sn = value; AddP(GetPN()); } }
        //private string _box_sn;
        public long? FLOW_ID { get { return _flow_id; } set { _flow_id = value; AddP(GetPN()); } }
        private long? _flow_id;
        public long? LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
        private long? _line_id;
        public string PROCESS_ALL { get { return _process_all; } set { _process_all = value; AddP(GetPN()); } }
        private string _process_all;
        public long? NODE_ID { get { return _node_id; } set { _node_id = value; AddP(GetPN()); } }
        private long? _node_id;
        public string TEST_RESULT { get { return _test_result; } set { _test_result = value; AddP(GetPN()); } }
        private string _test_result;
        public long? ERROR_ID { get { return _error_id; } set { _error_id = value; AddP(GetPN()); } }
        private long? _error_id;
        public DateTime? START_TIME { get { return _start_time; } set { _start_time = value; AddP(GetPN()); } }
        private DateTime? _start_time;
        public DateTime? END_TIME { get { return _end_time; } set { _end_time = value; AddP(GetPN()); } }
        private DateTime? _end_time;
        public bool? STATE { get { return _state; } set { _state = value; AddP(GetPN()); } }
        private bool? _state;
        public bool? NODE_STATE { get { return _node_state; } set { _node_state = value; AddP(GetPN()); } }
        private bool? _node_state;
        public bool? BREAK_STATE { get { return _break_state; } set { _break_state = value; AddP(GetPN()); } }
        private bool? _break_state;
    }
    /// <summary>
    /// 光猫产品盒装表
    /// </summary>
    public class BOX_MODEM : PRIMARY_KEY
    {
        //public string GUID { get { return _guid; } set { _guid = value; AddP(GetPN()); } }
        //private string _guid;
        public string BOX_NO { get { return _box_no; } set { _box_no = value; AddP(GetPN()); } }
        private string _box_no;
        public string PRODUCT_CODE { get { return _product_code; } set { _product_code = value; AddP(GetPN()); } }
        private string _product_code;
        public int COUNT { get { return _count; } set { _count = value; AddP(GetPN()); } }
        private int _count;
        public string PON_TYPE { get { return _ponType; } set { _ponType = value; AddP(GetPN()); } }
        private string _ponType;
        public bool FLAG { get { return _flag; } set { _flag = value; AddP(GetPN()); } }
        private bool _flag;
        public string PRO_NO_1 { get { return _pro_no_1; } set { _pro_no_1 = value; AddP(GetPN()); } }
        private string _pro_no_1;
        public string PRO_NO_2 { get { return _pro_no_2; } set { _pro_no_2 = value; AddP(GetPN()); } }
        private string _pro_no_2;
        public string PRO_NO_3 { get { return _pro_no_3; } set { _pro_no_3 = value; AddP(GetPN()); } }
        private string _pro_no_3;
        public string PRO_NO_4 { get { return _pro_no_4; } set { _pro_no_4 = value; AddP(GetPN()); } }
        private string _pro_no_4;
        public string PRO_NO_5 { get { return _pro_no_5; } set { _pro_no_5 = value; AddP(GetPN()); } }
        private string _pro_no_5;
        public string PRO_NO_6 { get { return _pro_no_6; } set { _pro_no_6 = value; AddP(GetPN()); } }
        private string _pro_no_6;
        public string PRO_NO_7 { get { return _pro_no_7; } set { _pro_no_7 = value; AddP(GetPN()); } }
        private string _pro_no_7;
        public string PRO_NO_8 { get { return _pro_no_8; } set { _pro_no_8 = value; AddP(GetPN()); } }
        private string _pro_no_8;
        public string PRO_NO_9 { get { return _pro_no_9; } set { _pro_no_9 = value; AddP(GetPN()); } }
        private string _pro_no_9;
        public string PRO_NO_10 { get { return _pro_no_10; } set { _pro_no_10 = value; AddP(GetPN()); } }
        private string _pro_no_10;
        public string PRO_NO_11 { get { return _pro_no_11; } set { _pro_no_11 = value; AddP(GetPN()); } }
        private string _pro_no_11;
        public string PRO_NO_12 { get { return _pro_no_12; } set { _pro_no_12 = value; AddP(GetPN()); } }
        private string _pro_no_12;
        public string PRO_NO_13 { get { return _pro_no_13; } set { _pro_no_13 = value; AddP(GetPN()); } }
        private string _pro_no_13;
        public string PRO_NO_14 { get { return _pro_no_14; } set { _pro_no_14 = value; AddP(GetPN()); } }
        private string _pro_no_14;
        public string PRO_NO_15 { get { return _pro_no_15; } set { _pro_no_15 = value; AddP(GetPN()); } }
        private string _pro_no_15;
        public string PRO_NO_16 { get { return _pro_no_16; } set { _pro_no_16 = value; AddP(GetPN()); } }
        private string _pro_no_16;
        public string PRO_NO_17 { get { return _pro_no_17; } set { _pro_no_17 = value; AddP(GetPN()); } }
        private string _pro_no_17;
        public string PRO_NO_18 { get { return _pro_no_18; } set { _pro_no_18 = value; AddP(GetPN()); } }
        private string _pro_no_18;
        public string PRO_NO_19 { get { return _pro_no_19; } set { _pro_no_19 = value; AddP(GetPN()); } }
        private string _pro_no_19;
        public string PRO_NO_20 { get { return _pro_no_20; } set { _pro_no_20 = value; AddP(GetPN()); } }
        private string _pro_no_20;
        public string DSNum_1 { get { return _dsnum_1; } set { _dsnum_1 = value; AddP(GetPN()); } }
        private string _dsnum_1;
        public string DSNum_2 { get { return _dsnum_2; } set { _dsnum_2 = value; AddP(GetPN()); } }
        private string _dsnum_2;
        public string DSNum_3 { get { return _dsnum_3; } set { _dsnum_3 = value; AddP(GetPN()); } }
        private string _dsnum_3;
        public string DSNum_4 { get { return _dsnum_4; } set { _dsnum_4 = value; AddP(GetPN()); } }
        private string _dsnum_4;
        public string DSNum_5 { get { return _dsnum_5; } set { _dsnum_5 = value; AddP(GetPN()); } }
        private string _dsnum_5;
        public string DSNum_6 { get { return _dsnum_6; } set { _dsnum_6 = value; AddP(GetPN()); } }
        private string _dsnum_6;
        public string DSNum_7 { get { return _dsnum_7; } set { _dsnum_7 = value; AddP(GetPN()); } }
        private string _dsnum_7;
        public string DSNum_8 { get { return _dsnum_8; } set { _dsnum_8 = value; AddP(GetPN()); } }
        private string _dsnum_8;
        public string DSNum_9 { get { return _dsnum_9; } set { _dsnum_9 = value; AddP(GetPN()); } }
        private string _dsnum_9;
        public string DSNum_10 { get { return _dsnum_10; } set { _dsnum_10 = value; AddP(GetPN()); } }
        private string _dsnum_10;
        public string DSNum_11 { get { return _dsnum_11; } set { _dsnum_11 = value; AddP(GetPN()); } }
        private string _dsnum_11;
        public string DSNum_12 { get { return _dsnum_12; } set { _dsnum_12 = value; AddP(GetPN()); } }
        private string _dsnum_12;
        public string DSNum_13 { get { return _dsnum_13; } set { _dsnum_13 = value; AddP(GetPN()); } }
        private string _dsnum_13;
        public string DSNum_14 { get { return _dsnum_14; } set { _dsnum_14 = value; AddP(GetPN()); } }
        private string _dsnum_14;
        public string DSNum_15 { get { return _dsnum_15; } set { _dsnum_15 = value; AddP(GetPN()); } }
        private string _dsnum_15;
        public string DSNum_16 { get { return _dsnum_16; } set { _dsnum_16 = value; AddP(GetPN()); } }
        private string _dsnum_16;
        public string DSNum_17 { get { return _dsnum_17; } set { _dsnum_17 = value; AddP(GetPN()); } }
        private string _dsnum_17;
        public string DSNum_18 { get { return _dsnum_18; } set { _dsnum_18 = value; AddP(GetPN()); } }
        private string _dsnum_18;
        public string DSNum_19 { get { return _dsnum_19; } set { _dsnum_19 = value; AddP(GetPN()); } }
        private string _dsnum_19;
        public string DSNum_20 { get { return _dsnum_20; } set { _dsnum_20 = value; AddP(GetPN()); } }
        private string _dsnum_20;
        public string DSNumX_1 { get { return _dsnumx_1; } set { _dsnumx_1 = value; AddP(GetPN()); } }
        private string _dsnumx_1;
        public string DSNumX_2 { get { return _dsnumx_2; } set { _dsnumx_2 = value; AddP(GetPN()); } }
        private string _dsnumx_2;
        public string DSNumX_3 { get { return _dsnumx_3; } set { _dsnumx_3 = value; AddP(GetPN()); } }
        private string _dsnumx_3;
        public string DSNumX_4 { get { return _dsnumx_4; } set { _dsnumx_4 = value; AddP(GetPN()); } }
        private string _dsnumx_4;
        public string DSNumX_5 { get { return _dsnumx_5; } set { _dsnumx_5 = value; AddP(GetPN()); } }
        private string _dsnumx_5;
        public string DSNumX_6 { get { return _dsnumx_6; } set { _dsnumx_6 = value; AddP(GetPN()); } }
        private string _dsnumx_6;
        public string DSNumX_7 { get { return _dsnumx_7; } set { _dsnumx_7 = value; AddP(GetPN()); } }
        private string _dsnumx_7;
        public string DSNumX_8 { get { return _dsnumx_8; } set { _dsnumx_8 = value; AddP(GetPN()); } }
        private string _dsnumx_8;
        public string DSNumX_9 { get { return _dsnumx_9; } set { _dsnumx_9 = value; AddP(GetPN()); } }
        private string _dsnumx_9;
        public string DSNumX_10 { get { return _dsnumx_10; } set { _dsnumx_10 = value; AddP(GetPN()); } }
        private string _dsnumx_10;
        public string DSNumX_11 { get { return _dsnumx_11; } set { _dsnumx_11 = value; AddP(GetPN()); } }
        private string _dsnumx_11;
        public string DSNumX_12 { get { return _dsnumx_12; } set { _dsnumx_12 = value; AddP(GetPN()); } }
        private string _dsnumx_12;
        public string DSNumX_13 { get { return _dsnumx_13; } set { _dsnumx_13 = value; AddP(GetPN()); } }
        private string _dsnumx_13;
        public string DSNumX_14 { get { return _dsnumx_14; } set { _dsnumx_14 = value; AddP(GetPN()); } }
        private string _dsnumx_14;
        public string DSNumX_15 { get { return _dsnumx_15; } set { _dsnumx_15 = value; AddP(GetPN()); } }
        private string _dsnumx_15;
        public string DSNumX_16 { get { return _dsnumx_16; } set { _dsnumx_16 = value; AddP(GetPN()); } }
        private string _dsnumx_16;
        public string DSNumX_17 { get { return _dsnumx_17; } set { _dsnumx_17 = value; AddP(GetPN()); } }
        private string _dsnumx_17;
        public string DSNumX_18 { get { return _dsnumx_18; } set { _dsnumx_18 = value; AddP(GetPN()); } }
        private string _dsnumx_18;
        public string DSNumX_19 { get { return _dsnumx_19; } set { _dsnumx_19 = value; AddP(GetPN()); } }
        private string _dsnumx_19;
        public string DSNumX_20 { get { return _dsnumx_20; } set { _dsnumx_20 = value; AddP(GetPN()); } }
        private string _dsnumx_20;
    }
    /// <summary>
    /// 工位表
    /// </summary>
    public class STATION : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = {"NAME","WORKER","LINE_ID","FLOW_ID","NODE_ID","DAY_PRODUCT","MONTH_PRODUCT","YEAR_PRODUCT","CONTEXT","ERROR_MSG" };
        public string MAC { get { return _mac; } set { _mac = value; AddP(GetPN()); } }
        private string _mac;
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public long? WORKER_ID { get { return _worker_id; } set { _worker_id = value; AddP(GetPN()); } }
        private long? _worker_id;
        public string WORKER_NAME { get { return _worker_name; } set { _worker_name = value; AddP(GetPN()); } }
        private string _worker_name;
        public long? LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
        private long? _line_id;
        public long? FLOW_ID { get { return _flow_id; } set { _flow_id = value; AddP(GetPN()); } }
        private long? _flow_id;
        public long? NODE_ID { get { return _node_id; } set { _node_id = value; AddP(GetPN()); } }
        private long? _node_id;
        public long? DAY_PRODUCT { get { return _day_product; } set { _day_product = value; AddP(GetPN()); } }
        private long? _day_product;
        public long? MONTH_PRODUCT { get { return _month_product; } set { _month_product = value; AddP(GetPN()); } }
        private long? _month_product;
        public long? YEAR_PRODUCT { get { return _year_product; } set { _year_product = value; AddP(GetPN()); } }
        private long? _year_product;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        public string ERROR_MSG { get { return _error_msg; } set { _error_msg = value; AddP(GetPN()); } }
        private string _error_msg;
        public string FLAG { get { return _flag; } set { _flag = value; AddP(GetPN()); } }
        private string _flag;
    }
    /// <summary>
    /// 员工表
    /// </summary>
    public class WORKER : PRIMARY_KEY
    {
        //private static readonly string[] UPDATE = { "NAME", "SEX", "AGE", "CARDID", "CONTEXT" };
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public string PARTMENT { get { return _partment; } set { _partment = value; AddP(GetPN()); } }
        private string _partment;
        public string SEX { get { return _sex; } set { _sex = value; AddP(GetPN()); } }
        private string _sex;
        public DateTime? BIRTHDAY { get { return _birthday; } set { _birthday = value; AddP(GetPN()); } }
        private DateTime? _birthday;
        public string PHONE { get { return _phone; } set { _phone = value; AddP(GetPN()); } }
        private string _phone;
        public DateTime? ENTER_DATE { get { return _enter_date; } set { _enter_date = value; AddP(GetPN()); } }
        private DateTime? _enter_date;
        public string MARRIAGE { get { return _marriage; } set { _marriage = value; AddP(GetPN()); } }
        private string _marriage;
        public string EDUCATION { get { return _edu; } set { _edu = value; AddP(GetPN()); } }
        private string _edu;
        public string CARDID { get { return _cardid; } set { _cardid = value; AddP(GetPN()); } }
        private string _cardid;
        public string EMERGENCY_CALL { get { return _emer; } set { _emer = value; AddP(GetPN()); } }
        private string _emer;
        public string NATION { get { return _nation; } set { _nation = value; AddP(GetPN()); } }
        private string _nation;
        public string SCHOOL { get { return _school; } set { _school = value; AddP(GetPN()); } }
        private string _school;
        public string MAJOR { get { return _major; } set { _major = value; AddP(GetPN()); } }
        private string _major;
        public string PLACE_ORIGIN { get { return _place; } set { _place = value; AddP(GetPN()); } }
        private string _place;
        public string HUKOU { get { return _hukou; } set { _hukou = value; AddP(GetPN()); } }
        private string _hukou;
        public DateTime? HETONG_START { get { return _hetong_start; } set { _hetong_start = value; AddP(GetPN()); } }
        private DateTime? _hetong_start;
        public DateTime? HETONG_END { get { return _hetong_end; } set { _hetong_end = value; AddP(GetPN()); } }
        private DateTime? _hetong_end;
        public DateTime? OUT_DATE { get { return _out_date; } set { _out_date = value; AddP(GetPN()); } }
        private DateTime? _out_date;
        public string ADDRESS { get { return _addr; } set { _addr = value; AddP(GetPN()); } }
        private string _addr;
        public string INTRODUCE { get { return _introduce; } set { _introduce = value; AddP(GetPN()); } }
        private string _introduce;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;
        public bool? FLAG { get { return _flag; } set { _flag = value; AddP(GetPN()); } }
        private bool? _flag;

    }
    /// <summary>
    ///产量统计表，按照小时计算
    ///</summary>
    public class PRODUCT_COUNT_DATA : PRIMARY_KEY
    {
        public DateTime COUNT_DATE { get { return _count_date; } set { _count_date = value; AddP(GetPN()); } }
        private DateTime _count_date;
        public int COUNT_TIME { get { return _count_time; } set { _count_time = value; AddP(GetPN()); } }
        private int _count_time;
        public long LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
        private long _line_id;
        public long NODE_ID { get { return _node_id; } set { _node_id = value; AddP(GetPN()); } }
        private long _node_id;
        public int ONETIME_PASS { get { return _onetime_pass; } set { _onetime_pass = value; AddP(GetPN()); } }
        private int _onetime_pass;
        public int PASS { get { return _pass; } set { _pass = value; AddP(GetPN()); } }
        private int _pass;
        public int TOTAL { get { return _total; } set { _total = value; AddP(GetPN()); } }
        private int _total;

    }
    /// <summary>
    /// 订单表
    /// </summary>
    public class YCD_ORDER : PRIMARY_KEY
    {
        public string ORDER_SN { get { return _order_sn; } set { _order_sn = value; AddP(GetPN()); } }
        private string _order_sn;
        public string PRODUCT_CODE { get { return _product_code; } set { _product_code = value; AddP(GetPN()); } }
        private string _product_code;
        public string PROVINCE { get { return _province; } set { _province = value; AddP(GetPN()); } }
        private string _province;
        public string DEVICE_TYPE { get { return _device_type; } set { _device_type = value; AddP(GetPN()); } }
        private string _device_type;
        public int NUMBER { get { return _number; } set { _number = value; AddP(GetPN()); } }
        private int _number;
        public int PRODUCT_NUMBER { get { return _proNum; } set { _proNum = value; AddP(GetPN()); } }
        private int _proNum;
        public bool FINISHED { get { return _finished; } set { _finished = value; AddP(GetPN()); } }
        private bool _finished;
        public bool DROPED { get { return _droped; } set { _droped = value; AddP(GetPN()); } }
        private bool _droped;

    }


    #endregion
    #region 产品数据数据库 Modem

    /// <summary>
    /// YCD内部MAC地址
    /// </summary>
    public class YCD_DEVICE : PRIMARY_KEY
    {
        public string YCD_MAC { get { return _ycd_mac; } set { _ycd_mac = value; AddP(GetPN()); } }
        private string _ycd_mac;
        public long? DEVICE_DATA_ID { get { return _device_data_id; } set { _device_data_id = value; AddP(GetPN()); } }
        private long? _device_data_id;
        public string PON_TYPE { get { return _pon_type; } set { _pon_type = value; AddP(GetPN()); } }
        private string _pon_type;
        public string LIGHT_MODULE_SN { get { return _light_module_sn; } set { _light_module_sn = value; AddP(GetPN()); } }
        private string _light_module_sn;
    }

    /// <summary>
    /// 生产数据库SN/MAC等信息
    /// </summary>
    public class Device_Data : PRIMARY_KEY
    {
        public string MACAddr { get { return _macaddr; } set { _macaddr = value; AddP(GetPN()); } }
        private string _macaddr;

        public string ORDER_SN { get { return _orderSn; } set { _orderSn = value; AddP(GetPN()); } }
        private string _orderSn;

        public string DeviceType { get { return _devicetype; } set { _devicetype = value; AddP(GetPN()); } }
        private string _devicetype;
        public string PONType { get { return _pontype; } set { _pontype = value; AddP(GetPN()); } }
        private string _pontype;
        public string SN { get { return _sn; } set { _sn = value; AddP(GetPN()); } }
        private string _sn;
        public string OUI1 { get { return _oui1; } set { _oui1 = value; AddP(GetPN()); } }
        private string _oui1;
        public string OUI2 { get { return _oui2; } set { _oui2 = value; AddP(GetPN()); } }
        private string _oui2;
        public string XPON_SN { get { return _xpon_sn; } set { _xpon_sn = value; AddP(GetPN()); } }
        private string _xpon_sn;
        public string WIFI_SSID { get { return _wifi_ssid; } set { _wifi_ssid = value; AddP(GetPN()); } }
        private string _wifi_ssid;
        public string WIFI_Password { get { return _wifi_password; } set { _wifi_password = value; AddP(GetPN()); } }
        private string _wifi_password;
        public string WIFI_5G_SSID { get { return _wifi_5g_ssid; } set { _wifi_5g_ssid = value; AddP(GetPN()); } }
        private string _wifi_5g_ssid;
        public string WIFI_5G_Password { get { return _wifi_5g_password; } set { _wifi_5g_password = value; AddP(GetPN()); } }
        private string _wifi_5g_password;
        public string ITV_SSID { get { return _itv_ssid; } set { _itv_ssid = value; AddP(GetPN()); } }
        private string _itv_ssid;
        public string ITV_Password { get { return _itv_password; } set { _itv_password = value; AddP(GetPN()); } }
        private string _itv_password;

        public string ITV_MAC { get { return _itv_mac; } set { _itv_mac = value; AddP(GetPN()); } }
        private string _itv_mac;
        public string STBID { get { return _stbid; } set { _stbid = value; AddP(GetPN()); } }
        private string _stbid;
        public string WedUser { get { return _weduser; } set { _weduser = value; AddP(GetPN()); } }
        private string _weduser;
        public string WedPassword { get { return _wedpassword; } set { _wedpassword = value; AddP(GetPN()); } }
        private string _wedpassword;
        //public string LightModule { get { return _lightmodule; } set { _lightmodule = value; AddP(GetPN()); } }
        //private string _lightmodule;
        public string LightModuleSN { get { return _lightmodulesn; } set { _lightmodulesn = value; AddP(GetPN()); } }
        private string _lightmodulesn;
        public string ProductCode { get { return _productcode; } set { _productcode = value; AddP(GetPN()); } }
        private string _productcode;
        public string DeviceSerialNumber { get { return _deviceserialnumber; } set { _deviceserialnumber = value; AddP(GetPN()); } }
        private string _deviceserialnumber;
        public string DeviceSerialNumber1 { get { return _deviceserialnumber1; } set { _deviceserialnumber1 = value; AddP(GetPN()); } }
        private string _deviceserialnumber1;
        public string LanIP { get { return _lanip; } set { _lanip = value; AddP(GetPN()); } }
        private string _lanip;
        public DateTime date1 { get { return _date1; } set { _date1 = value; AddP(GetPN()); } }
        private DateTime _date1;
        public string CMIIT_ID { get { return _cmiit_id; } set { _cmiit_id = value; AddP(GetPN()); } }
        private string _cmiit_id;

        //增加两个内容_其一，MAC运送的省份，其二，校验码172位key
        public string HW_CIPHER { get { return _hwCipher; } set { _hwCipher = value; AddP(GetPN()); } }
        private string _hwCipher;

        public string HW_PROVINCE_NAME { get { return _hwProvince; } set { _hwProvince = value; AddP(GetPN()); } } 
        private string _hwProvince;

        public string BUILD_TIME { get { return _build_time; } set { _build_time = value; AddP(GetPN()); } }
        private string _build_time;

        public bool USED { get { return _used; } set { _used = value; AddP(GetPN()); } }
        private bool _used;
    }
    /// <summary>
    /// 产品信息类型
    /// </summary>
    public class Device_Type : TableBase
    {
        public string DeviceType { get { return _devicetype; } set { _devicetype = value; AddP(GetPN()); } }
        private string _devicetype;
        public string PROVINCE { get { return _province; } set { _province = value; AddP(GetPN()); } }
        private string _province;
        public string SWVersionInside { get { return _swversioninside; } set { _swversioninside = value; AddP(GetPN()); } }
        private string _swversioninside;
        public string SWVersion { get { return _swversion; } set { _swversion = value; AddP(GetPN()); } }
        private string _swversion;
        public string BuildTime { get { return _buildtime; } set { _buildtime = value; AddP(GetPN()); } }
        private string _buildtime;
        public string HWVersion { get { return _hwversion; } set { _hwversion = value; AddP(GetPN()); } }
        private string _hwversion;
        //软件版本检验码  ShenzhenYouhuaTech，默认为此
        public string HWCopyright { get { return _hwCopy; } set { _hwCopy = value; AddP(GetPN()); } }
        private string _hwCopy;
        public string XPONMode { get { return _xponmode; } set { _xponmode = value; AddP(GetPN()); } }
        private string _xponmode;
        public string TelnetUser { get { return _telnetuser; } set { _telnetuser = value; AddP(GetPN()); } }
        private string _telnetuser;
        public string TelnetPassword { get { return _telnetpassword; } set { _telnetpassword = value; AddP(GetPN()); } }
        private string _telnetpassword;
        public string TelnetHint { get { return _telnethint; } set { _telnethint = value; AddP(GetPN()); } }
        private string _telnethint;
        //public string TelnetIP { get { return _telnetip; } set { _telnetip = value; AddP(GetPN()); } }
        //private string _telnetip;
        public int isDualBand { get { return _isdualband; } set { _isdualband = value; AddP(GetPN()); } }
        private int _isdualband;
        public string WlanTelnet { get { return _wlantelnet; } set { _wlantelnet = value; AddP(GetPN()); } }
        private string _wlantelnet;
        public string LanTelnet { get { return _lantelnet; } set { _lantelnet = value; AddP(GetPN()); } }
        private string _lantelnet;
        public string PluginName { get { return _pluginname; } set { _pluginname = value; AddP(GetPN()); } }
        private string _pluginname;
        public string PluginRun { get { return _pluginrun; } set { _pluginrun = value; AddP(GetPN()); } }
        private string _pluginrun;
        public string FrameWork1 { get { return _framework1; } set { _framework1 = value; AddP(GetPN()); } }
        private string _framework1;
        public string FrameWork2 { get { return _framework2; } set { _framework2 = value; AddP(GetPN()); } }
        private string _framework2;

        //add_18.1.4
        public string Manufacturer { get { return _manu; } set { _manu = value; AddP(GetPN()); } }
        private string _manu;
        public string securitycheck { get { return _security; } set { _security = value; AddP(GetPN()); } }
        private string _security;
        public string PluginNum { get { return _pluginNum; } set { _pluginNum = value; AddP(GetPN()); } }
        private string _pluginNum;

        //add_18.1.6
        public string WanConnect { get { return _wanconnect; } set { _wanconnect = value; AddP(GetPN()); } }
        private string _wanconnect;
        public string APPS { get { return _apps; } set { _apps = value; AddP(GetPN()); } }
        private string _apps;
        public string FrameworkActive { get { return _frameworkactive; } set { _frameworkactive = value; AddP(GetPN()); } }
        private string _frameworkactive;
        public string URL { get { return _url; } set { _url = value; AddP(GetPN()); } }
        private string _url;
        public string RelativeURL { get { return _relativeurl; } set { _relativeurl = value; AddP(GetPN()); } }
        private string _relativeurl;
        //重复
        //public string LastChangedRev { get { return _lastchangedrev; } set { _lastchangedrev = value; AddP(GetPN()); } }
        //private string _lastchangedrev;
        public string LastChangedDate { get { return _lastchangeddate; } set { _lastchangeddate = value; AddP(GetPN()); } }
        private string _lastchangeddate;

        //add 18.8.3
        public string BoBtable4check { get { return _bobtable4check; } set { _bobtable4check = value; AddP(GetPN()); } }
        private string _bobtable4check;
        public string BoBtable5check { get { return _bobtable5check; } set { _bobtable5check = value; AddP(GetPN()); } }
        private string _bobtable5check;

        public string ProcessName { get { return _processname; } set { _processname = value; AddP(GetPN()); } }
        private string _processname;

        //add 18.10.10
        public string IP { get { return _ip; } set { _ip = value; AddP(GetPN()); } }
        private string _ip;

        //add 19.3.7
        public string ProductAgingResult { get { return _aging; } set { _aging = value; AddP(GetPN()); } }
        private string _aging;

        public string iptvHWVersion { get { return _iptvH; } set { _iptvH = value; AddP(GetPN()); } }
        private string _iptvH;
        public string iptvSWVersion { get { return _iptvS; } set { _iptvS = value; AddP(GetPN()); } }
        private string _iptvS;
        public string iptvCompileTime { get { return _iptvC; } set { _iptvC = value; AddP(GetPN()); } }
        private string _iptvC;
    }
    /// <summary>
    /// BOSA相关数据
    /// </summary>
    public class BOSA_DATA : PRIMARY_KEY
    {
        public string SN { get { return _sn; } set { _sn = value; AddP(GetPN()); } }
        private string _sn;
        public string DeviceType { get { return _devicetype; } set { _devicetype = value; AddP(GetPN()); } }
        private string _devicetype;
        public long? BOB_TYPE_ID { get { return _bobTypeId; } set { _bobTypeId = value; AddP(GetPN()); } }
        private long? _bobTypeId;
        public string WorkSheet { get { return _worksheet; } set { _worksheet = value; AddP(GetPN()); } }
        private string _worksheet;
        public string productCode { get { return _productcode; } set { _productcode = value; AddP(GetPN()); } }
        private string _productcode;
        public string small_box_no { get { return _small_box_no; } set { _small_box_no = value; AddP(GetPN()); } }
        private string _small_box_no;
        public string middle_box_no { get { return _middle_box_no; } set { _middle_box_no = value; AddP(GetPN()); } }
        private string _middle_box_no;
        public string box_no { get { return _box_no; } set { _box_no = value; AddP(GetPN()); } }
        private string _box_no;
        public double? Ith_mA { get { return _ith_ma; } set { _ith_ma = value; AddP(GetPN()); } }
        private double? _ith_ma;
        public double? Po_dBm { get { return _po_dbm; } set { _po_dbm = value; AddP(GetPN()); } }
        private double? _po_dbm;
        public double? Io_mA { get { return _io_ma; } set { _io_ma = value; AddP(GetPN()); } }
        private double? _io_ma;
        public double? Imo_mA { get { return _imo_ma; } set { _imo_ma = value; AddP(GetPN()); } }
        private double? _imo_ma;
        public double? Es { get { return _es; } set { _es = value; AddP(GetPN()); } }
        private double? _es;
        public double? Rs { get { return _rs; } set { _rs = value; AddP(GetPN()); } }
        private double? _rs;
        public double? MPD_Id_nA { get { return _mpd_id_na; } set { _mpd_id_na = value; AddP(GetPN()); } }
        private double? _mpd_id_na;
        public double? Kink_Im { get { return _kink_im; } set { _kink_im = value; AddP(GetPN()); } }
        private double? _kink_im;
        public double? Kink_P { get { return _kink_p; } set { _kink_p = value; AddP(GetPN()); } }
        private double? _kink_p;
        public double? VBR_V { get { return _vbr_v; } set { _vbr_v = value; AddP(GetPN()); } }
        private double? _vbr_v;
        public double? VBR_Temp { get { return _vbr_temp; } set { _vbr_temp = value; AddP(GetPN()); } }
        private double? _vbr_temp;
        public double? VBR_Slope_Down { get { return _vbr_slope_down; } set { _vbr_slope_down = value; AddP(GetPN()); } }
        private double? _vbr_slope_down;
        public double? VBR_Slope_Up { get { return _vbr_slope_up; } set { _vbr_slope_up = value; AddP(GetPN()); } }
        private double? _vbr_slope_up;
        public double? Res { get { return _res; } set { _res = value; AddP(GetPN()); } }
        private double? _res;
        public double? PT_Id_nA { get { return _pt_id_na; } set { _pt_id_na = value; AddP(GetPN()); } }
        private double? _pt_id_na;
        public double? Icc_mA { get { return _icc_ma; } set { _icc_ma = value; AddP(GetPN()); } }
        private double? _icc_ma;
        public double? Sen_dBm { get { return _sen_dbm; } set { _sen_dbm = value; AddP(GetPN()); } }
        private double? _sen_dbm;
        public double? Xtalk_dB { get { return _xtalk_db; } set { _xtalk_db = value; AddP(GetPN()); } }
        private double? _xtalk_db;
        public double? Io_P { get { return _io_p; } set { _io_p = value; AddP(GetPN()); } }
        private double? _io_p;
        public double? Im1_P { get { return _im1_p; } set { _im1_p = value; AddP(GetPN()); } }
        private double? _im1_p;
        public DateTime? Date_Test { get { return _date_test; } set { _date_test = value; AddP(GetPN()); } }
        private DateTime? _date_test;
        public DateTime? Date_Package { get { return _date_package; } set { _date_package = value; AddP(GetPN()); } }
        private DateTime? _date_package;

    }

    public class BOB_DEFAULT : PRIMARY_KEY
    {
        public int BG_MIN { get { return _bg_min; } set { _bg_min = value; AddP(GetPN()); } }
        private int _bg_min;
        public int BG_MAX { get { return _bg_max; } set { _bg_max = value; AddP(GetPN()); } }
        private int _bg_max;
        public double POWER_MIN { get { return _power_min; } set { _power_min = value; AddP(GetPN()); } }
        private double _power_min;
        public double POWER_MAX { get { return _power_max; } set { _power_max = value; AddP(GetPN()); } }
        private double _power_max;
        public int TABLE_ID { get { return _table_id; } set { _table_id = value; AddP(GetPN()); } }
        private int _table_id;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;

    }

    public class BOB_TYPE : PRIMARY_KEY
    {
        public string COMPANY { get { return _company; } set { _company = value; AddP(GetPN()); } }
        private string _company;
        public string PON_TYPE { get { return _pon_type; } set { _pon_type = value; AddP(GetPN()); } }
        private string _pon_type;
        public int BG_MIN { get { return _bg_min; } set { _bg_min = value; AddP(GetPN()); } }
        private int _bg_min;
        public int BG_MAX { get { return _bg_max; } set { _bg_max = value; AddP(GetPN()); } }
        private int _bg_max;
        public double POWER_MIN { get { return _power_min; } set { _power_min = value; AddP(GetPN()); } }
        private double _power_min;
        public double POWER_MAX { get { return _power_max; } set { _power_max = value; AddP(GetPN()); } }
        private double _power_max;

    }

    public class BOB_DATA : TableBase
    {
        public long TYPE_ID { get { return _type_id; } set { _type_id = value; AddP(GetPN()); } }
        private long _type_id;
        public int TABLE_ID { get { return _table_id; } set { _table_id = value; AddP(GetPN()); } }
        private int _table_id;
        public int INDEX_START { get { return _index_start; } set { _index_start = value; AddP(GetPN()); } }
        private int _index_start;
        public int INDEX_END { get { return _index_end; } set { _index_end = value; AddP(GetPN()); } }
        private int _index_end;
        public string CONTEXT { get { return _context; } set { _context = value; AddP(GetPN()); } }
        private string _context;

    }

    #endregion
    #region 测试请求与回复
    public class StartRequest
    {
        public string PRODUCT_MAC { get; set; }//产品MAC地址
        public string PRODUCT_SN { get; set; }//产品SN号码
        //public string PRODUCT_IDENTIFY { get; set; }//产品标志码
        public string STATION_MAC { get; set; }//机器MAC地址
    }
    #endregion
    #region 软件更新
    /// <summary>
    /// 软件和其版本信息
    /// </summary>
    public class SOFTWARE:TableBase
    {
        public string NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public string VERSION { get { return _version; } set { _version = value; AddP(GetPN()); } }
        private string _version;
        public string FILE_NAME { get { return _file_name; } set { _file_name = value; AddP(GetPN()); } }
        private string _file_name;
        public string LINK_ADDRESS { get { return _link_address; } set { _link_address = value; AddP(GetPN()); } }
        private string _link_address;
        public DateTime? UPDATE_TIME { get { return _update_time; } set { _update_time = value; AddP(GetPN()); } }
        private DateTime? _update_time;
    }
    #endregion
    #region SN号码表
    public class PROVINCE : TableBase
    {
        public string PROVINCE_NAME { get { return _name; } set { _name = value; AddP(GetPN()); } }
        private string _name;
        public string PROVINCE_CODE { get { return _code; } set { _code = value; AddP(GetPN()); } }
        private string _code;
    }
    /// <summary>
    /// 产品SN
    /// </summary>
    public class PRODUCT_SN : PRIMARY_KEY
    {
        public int YEAR { get { return _year; } set { _year = value; AddP(GetPN()); } }
        private int _year;
        public int MONTH { get { return _month; } set { _month = value; AddP(GetPN()); } }
        private int _month;
        public long SN_NUM { get { return _sn_num; } set { _sn_num = value; AddP(GetPN()); } }
        private long _sn_num;
        public long BOX_SN { get { return _box_sn; } set { _box_sn = value; AddP(GetPN()); } }
        private long _box_sn;
        public string ORDER_SN { get { return _order_sn; } set { _order_sn = value; AddP(GetPN()); } }
        private string _order_sn;
        public string FULL_PRODUCT_SN { get { return _full_product_sn; } set { _full_product_sn = value; AddP(GetPN()); } }
        private string _full_product_sn;
        public string FULL_BOX_SN { get { return _full_box_sn; } set { _full_box_sn = value; AddP(GetPN()); } }
        private string _full_box_sn;
        public string MAC { get { return _mac; } set { _mac = value; AddP(GetPN()); } }
        private string _mac;
        public long LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
        private long _line_id;
        public DateTime DISTRIBUTE_DATE { get { return _distribute_date; } set { _distribute_date = value; AddP(GetPN()); } }
        private DateTime _distribute_date;
    }

    public class PRODUCT_SN_LOG : PRIMARY_KEY
    {
        public string ORDER_SN { get { return _order_sn; } set { _order_sn = value; AddP(GetPN()); } }
        private string _order_sn;
        public long LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
        private long _line_id;
        public int DIST_NUMBER { get { return _dist_number; } set { _dist_number = value; AddP(GetPN()); } }
        private int _dist_number;
        public int START_SN { get { return _start_sn; } set { _start_sn = value; AddP(GetPN()); } }
        private int _start_sn;
        public int END_SN { get { return _end_sn; } set { _end_sn = value; AddP(GetPN()); } }
        private int _end_sn;
        public DateTime LOG_TIME { get { return _log_time; } set { _log_time = value; AddP(GetPN()); } }
        private DateTime _log_time;

    }

    /// <summary>
    /// 当前SN号码分配情况
    /// </summary>
    //public class View_SnList : TableBase
    //{
    //    public long LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
    //    private long _line_id;
    //    public string PROVINCE { get { return _province; } set { _province = value; AddP(GetPN()); } }
    //    private string _province;
    //    public string TYPE { get { return _type; } set { _type = value; AddP(GetPN()); } }
    //    private string _type;
    //    public bool IS_USE { get { return _is_use; } set { _is_use = value; AddP(GetPN()); } }
    //    private bool _is_use;
    //    public int SN_COUNT { get { return _sn_count; } set { _sn_count = value; AddP(GetPN()); } }
    //    private int _sn_count;
    //    public long MIN_SN { get { return _min; } set { _min = value; AddP(GetPN()); } }
    //    private long _min;
    //    public long MAX_SN { get { return _max; } set { _max = value; AddP(GetPN()); } }
    //    private long _max;
    //}

    /// <summary>
    /// 分配箱子/盒子SN号的条件
    /// </summary>
    //public class CONDITION_SN : TableBase
    //{
    //    public long LINE_ID { get { return _line_id; } set { _line_id = value; AddP(GetPN()); } }
    //    private long _line_id;
    //    /// <summary>
    //    /// 产品类型PT924/PT924G/PT924 G
    //    /// </summary>
    //    public string TYPE { get { return _type; } set { _type = value; AddP(GetPN()); } }
    //    private string _type;
    //    /// <summary>
    //    /// 省份信息HN_924G/SC_924
    //    /// </summary>
    //    public string PROVINCE { get { return _province; } set { _province = value; AddP(GetPN()); } }
    //    private string _province;
    //    public long BLOCK_NUM { get { return _num; } set { _num = value; AddP(GetPN()); } }
    //    private long _num;
    //    public string MSG { get { return _msg; } set { _msg = value; AddP(GetPN()); } }
    //    private string _msg;
    //}

    #endregion
}